<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Order_sn')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-order_sn" data-rule="required" class="form-control" name="row[order_sn]" type="text" value="{$row.order_sn|htmlentities}" disabled>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Vehicle_id')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-vehicle_id" data-rule="required" min="0" data-source="vehicle/index" class="form-control selectpage" name="row[vehicle_id]" disabled type="text" value="{$row.vehicle_id|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Vehicle_name')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-vehicle_name" data-rule="required" class="form-control" name="row[vehicle_name]" type="text" disabled value="{$row.vehicle_name|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Price')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-price" data-rule="required" min="0" class="form-control" step="0.01" name="row[price]" disabled type="number" value="{$row.price|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Mobile')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-mobile" data-rule="required" class="form-control" name="row[mobile]" disabled type="text" value="{$row.mobile|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-user_id" data-rule="required" min="0" data-source="user/user/index" data-field="username" class="form-control selectpage" disabled name="row[user_id]" type="text" value="{$row.user_id|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Detection_id')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-detection_id"  min="0" data-source="user/user/index"  data-field="username"  disabled class="form-control selectpage" name="row[user_id]" data-dismiss="" type="text" value="{$row.detection_id|htmlentities}">
        </div>
    </div>
    {if $row.status==5}
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('审核')}:</label>
        <div class="col-xs-12 col-sm-8">

            <div class="radio">
                <label ><input  name="row[status]" type="radio" value="6"  /> 驳回</label>
                <label><input  name="row[status]" type="radio" value="4"  checked/> 通过</label>
            </div>

        </div>
    </div>
    {/if}
    {if $row.status==4}
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('是否需要重新检测订单')}:</label>
        <div class="col-xs-12 col-sm-8">

            <div class="radio">
                <label ><input  name="row[is_rock]" type="radio" value="1"  /> 是</label>
                <label><input  name="row[is_rock]" type="radio" value="2"  checked/> 不是</label>
            </div>

        </div>
    </div>
    {/if}
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="radio">
                {foreach name="statusList" item="vo"}
                {if $key==$row.status}
                <input id="c-status"  class="form-control"  disabled type="text" value="{$vo|htmlentities}">
                {/if}
                {/foreach}
            </div>
        </div>
    </div>


    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Register_time')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-register_time" class="form-control  disabled"  disabled  name="row[register_time]" type="text" value="{$row.register_time}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Mileage')}(km):</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-mileage" data-rule="required" min="0" class="form-control disabled" disabled step="0.01" name="row[mileage]" type="number" value="{$row.mileage|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Use_type')}:</label>
        <div class="col-xs-12 col-sm-8">
                        
            <select  id="c-use_type" data-rule="required" min="0" class="form-control selectpicker" name="row[use_type]" disabled>
                {foreach name="useTypeList" item="vo"}
                    <option value="{$key}" {in name="key" value="$row.use_type"}selected{/in}>{$vo}</option>
                {/foreach}
            </select>

        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('能源类型')}:</label>
        <div class="col-xs-12 col-sm-8" style="line-height: 35px">
            {if $row.energy_type==1}
            新能源
            {else /}
            燃油车
            {/if}
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Car_type')}:</label>
        <div class="col-xs-12 col-sm-8">

            <select  id="c-car_type" min="0" class="form-control selectpicker" name="row[car_type]" disabled>
                {foreach name="carTypeList" item="vo"}
                    <option value="{$key}" {in name="key" value="$row.car_type"}selected{/in}>{$vo}</option>
                {/foreach}
            </select>

        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Paytime')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input   min="0"  class="form-control " disabled name="row[user_id]" type="text" value="{$row.pay_time|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('车辆vin')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input   min="0"  class="form-control " disabled name="row[user_id]" type="text" value="{$row.vin|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('上门地址')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input  min="0"  class="form-control " disabled name="row[up_address]" type="text" value="{$row.up_address|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('上门时间')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input  min="0"  class="form-control " disabled name="row[up_time]" type="text" value="{$row.up_time|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('联系人')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input   min="0" class="form-control " disabled name="row[contacts]" type="text" value="{$row.contacts|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('行驶证')}:</label>
        <div class="col-xs-12 col-sm-8">
            <img class="img-sm img-center" onclick="previewImg(this)" src="{$row.vin_image|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('是否火烧')}:</label>
        <div class="col-xs-12 col-sm-8" style="line-height: 35px">
            {if $row.is_burn==1}
            是
            {else /}
            不是
            {/if}
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('是否水泡')}:</label>
        <div class="col-xs-12 col-sm-8" style="line-height: 35px">
            {if $row.is_water==1}
            是
            {else /}
            不是
            {/if}
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('是否事故')}:</label>
        <div class="col-xs-12 col-sm-8" style="line-height: 35px">
            {if $row.is_accident==1}
            是
            {else /}
            不是
            {/if}
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('检测结论')}:</label>
        <div class="col-xs-12 col-sm-8">
            <textarea disabled style="
                      width: 100%;
                      height: 160px;
                      "> {$row.order_remake} </textarea>
        </div>
    </div>

    <table class="table table-bordered table-hover">
        <thead>
        <tr>
            <th style="text-align: center;vertical-align: middle;" colspan="13">
                <h3 style="color: red;">车辆周围图片</h3>
            </th>
        </tr>
        </thead>
        <tr class="goods-title">
            <th>位置</th>
            <th>图片</th>
        </tr>
        <tbody>
        {foreach name="row.car_round" item="vo1"}
        <tr>
            <td style="text-align: center; vertical-align: middle;">{$vo1.desc}</td>
            <td style="text-align: center; vertical-align: middle; "><a href="javascript:">
                <img class="img-sm img-center" onclick="previewImg(this)" src="{$vo1.image|htmlentities}">
            </a></td>
        </tr>
        {/foreach}

        </tbody>
    </table>

    <table class="table table-bordered table-hover">
        <thead>
        <tr>
            <th style="text-align: center;vertical-align: middle;" colspan="13">
                <h3 style="color: red;">检查信息</h3>
            </th>
        </tr>
        </thead>
        <tr class="goods-title">
            <th>项目名</th>
            <th>图片</th>
            <th>状态</th>
            <th>备注</th>
        </tr>
        <tbody>
        {foreach name="row.multiplejson1" item="vo"}
        <tr>
            <td style="text-align: center; vertical-align: middle;">{$vo.overhaul_name}</td>
            <td style="text-align: center; vertical-align: middle; "><a href="javascript:">
                {if $vo.overhaul_remark_image}
                {foreach $vo.overhaul_remark_image as $vo1}
                <img class="img-sm img-center" onclick="previewImg(this)" src="{$vo1|htmlentities}">
                {/foreach}

                {/if}
            </a></td>
            <td style="text-align: center; vertical-align: middle;">{$vo.overhaul_status_text}</td>
            <td style="text-align: center; vertical-align: middle;">{$vo.overhaul_remark}</td>
        </tr>
        {/foreach}

        </tbody>
    </table>

    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-primary btn-embossed ">{:__('OK')}</button>
        </div>
    </div>
</form>
<script src="__CDN__/assets/libs/jquery/dist/jquery.min.js"></script>

<script>
    function previewImg(obj) {
        var img = new Image();
        img.src = obj.src;
        img.onload = function () {
            // 获取图片的原始宽高
            var originalWidth = img.naturalWidth;
            var originalHeight = img.naturalHeight;

            // 根据需求设置弹出层的宽高
            var maxWidth = 800; // 弹窗最大宽度
            var maxHeight = 600; // 弹窗最大高度
            var width = originalWidth;
            var height = originalHeight;

            // 如果图片超过最大宽高，按比例缩放
            if (width > maxWidth || height > maxHeight) {
                var scale = Math.min(maxWidth / width, maxHeight / height);
                width = width * scale;
                height = height * scale;
            }

            // 弹出层内容
            var imgHtml = "<img src='" + obj.src + "' width='100%' height='100%' style='display:block;margin:auto;'/>";

            // 使用 layer 弹出层
            layer.open({
                title: false,
                type: 1,
                shade: 0.8,
                offset: 'auto',
                area: [width + 'px', height + 'px'], // 设置宽高
                shadeClose: true,
                scrollbar: false,
                content: imgHtml,
                cancel: function () {
                    // 可添加弹窗关闭后的逻辑
                }
            });
        };

        img.onerror = function () {
            console.error('图片加载失败：', obj.src);
            layer.msg('图片加载失败', {icon: 2});
        }
    }

</script>
